1 <?
2 if
(isset($_POST['butSaveLoai'])) {
3     $question=$_POST[
'txtQuestion'];
4     $answer=$_POST[
'txtAnswer'];
5     $name=($_POST[
'txtName']);
6     $ten=($_POST[
'txtTen']);
7     $phone=($_POST[
'txtPhone']);
8     $email=($_POST[
'txtEmail']);
9     $order=(
int)$_POST['txtSortOrder'];
10     $status=($_POST[
'chkShow']!=''?1:0);
11     $categories_id=$_POST[
'txtParent'];
12     $gioitinh=$_POST[
'ddGt'];
13
14     $page = $_POST[
'page'];
15
16     $err=
"";
17     
if (strlen($ten)<=0) $err="B&#7841;n ch&#432;a nh&#7853;p tên câu h&#7887;i<br>";
18
19     
if (strlen($question)<=0) $err="B&#7841;n ch&#432;a nh&#7853;p câu h&#7887;i<br>";
20
21     
if ($err=='')
22     {
23         
if (!empty($_POST['id'])) {
24             $oldid = $_POST[
'id'];
25             $sql =
"update faq set faq_nameqa='".$ten."',faq_question='".$question."',faq_answer='".$answer."',faq_name='".$name."',faq_phone='".$phone."',faq_email='".$email."',faq_sortorder='".$order."',faq_status='".$status."',faq_gioitinh='".$gioitinh."',faq_categoriesid='".$categories_id."' where faq_id='".$oldid."'";
26         }
else {
27             $sql =
"insert into faq (faq_nameqa,faq_question,faq_answer,faq_name,faq_phone,faq_email,faq_sortorder,faq_status,faq_dateadded,faq_categoriesid,faq_gioitinh) values ('".$ten."','".$question."','".$answer."','".$name."','".$phone."','".$email."','".$order."','".$status."',SYSDATE(),'".$categories_id."','".gioitinh."')";
28         }
29         
if (mysql_query($sql,$con)) {
30             
//echo $sqlUpdate;exit(0);
31         }
32         
else {
33             $err =
"<p align=center class='err'>Không th&#7875; c&#7853;p nh&#7853;t</p>";
34         }
35     }
36     
if ($err=='') echo '<script>window.location="index.php?act=faq&status='.$_REQUEST['status'].'&cat='.$_REQUEST['cat'].'&page='.$_REQUEST['page'].'&code=1"</script>';
37     
else echo "<p align=center class='err'>".$err."</p>";
38 }
39 ?>
40
41 <?
42     
if (isset($_GET['id'])) {
43         $oldid=$_GET[
'id'];
44         $page = $_GET[
'page'];
45         $sql =
"select * from faq where faq_id='".$oldid."' limit 1";
46         $result=mysql_query($sql,$con);
47         
if ($row=mysql_fetch_array($result)) {
48             $question=$row[
'faq_question'];
49             $answer=$row[
'faq_answer'];
50             $name=$row[
'faq_name'];
51             $ten=$row[
'faq_nameqa'];
52
53             $phone=$row[
'faq_phone'];
54             $email=$row[
'faq_email'];
55
56             $order=(
int)$row['faq_sortorder'];
57             $status=$row[
'faq_status'];
58             $categories_id=$row[
'faq_categoriesid'];
59             $gioitinh=$row[
'faq_gioitinh'];
60
61         }
62     }
63 ?>
64  
65 <script language=
"Javascript1.2"><!-- // load htmlarea
66 _editor_url =
"htmlarea/"; // URL to htmlarea files
67 var
win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
68 if
(navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; }
69 if
(navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
70 if
(navigator.userAgent.indexOf('Opera') >= 0) { win_ie_ver = 0; }
71 if
(win_ie_ver >= 5.5) {
72   document.write(
'<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
73   document.write(
' language="Javascript1.2"></scr' + 'ipt>');
74 }
else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }
75 // --></script>

76
77 <form method=
"post" action="index.php">
78 <input type=
"hidden" name="act" value="faq_m">
79 <input type=
"hidden" name="id" value="<? echo $_REQUEST['id']; ?>">
80 <input type=
"hidden" name="status" value="<? echo $_REQUEST['status']; ?>">
81 <table border=
"1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
82   <tr>
83     <td width=
"45%" class="title" align="center" height="20">S&#7917;a / C&#7853;p nh&#7853;t : T&#432;
84     v&#
7845;n</td>
85   </tr>
86   <tr>
87     <td width=
"45%">
88     <table border=
"0" cellpadding="2" bordercolor="#111111" width="100%" id="AutoNumber2" cellspacing="0">
89         <tr>
90         <td width=
"17%" class="smallfont" align="right">
91         Tên câu h&#
7887;i</td>
92         <td width=
"1%" class="smallfont" align="center">
93         <font color=
"#FF0000">*</font></td>
94         <td width=
"80%" class="smallfont">
95         <INPUT
value="<? echo $ten; ?>" TYPE="text" NAME="txtTen" CLASS=textbox size="98"></td>
96       </tr>
97
98       <tr>
99         <td width=
"17%" class="smallfont">
100         <p align=
"right">Câu h&#7887;i</td>
101         <td width=
"1%" class="smallfont" align="center">
102         <font color=
"#FF0000">*</font></td>
103         <td width=
"80%" class="smallfont">
104         <textarea rows=
"6" name="txtQuestion" cols="28" style="width: 100%"><? echo $question; ?></textarea></td>
105       </tr>
106       <tr>
107         <td width=
"17%" class="smallfont" align="right">
108         Tr&#
7843; l&#7901;i</td>
109         <td width=
"1%" class="smallfont" align="center">
110         &nbsp;</td>
111         <td width=
"80%" class="smallfont">
112         <textarea rows=
"6" name="txtAnswer" cols="28"><? echo $answer; ?></textarea>
113
114 <script language=
"javascript1.2" defer>
115         
var config = new Object(); // create new config object
116
117         config.width =
"100%";
118         config.height =
"150px";
119         config.bodyStyle =
'background-color: white; font-family: "Verdana"; font-size: x-small;';
120         config.debug =
0;
121
122         
// NOTE: You can remove any of these blocks and use the default config!
123
124         config.toolbar = [
125                 [
'fontname'],
126              [
'fontsize'],
127                 [
'fontstyle'],
128                 [
'linebreak'],
129              [
'bold','italic','underline','separator'],
130             [
'strikethrough','subscript','superscript','separator'],
131             [
'justifyleft','justifycenter','justifyright','separator'],
132              [
'OrderedList','UnOrderedList','Outdent','Indent','separator'],
133              [
'forecolor','backcolor','separator'],
134              [
'HorizontalRule','Createlink','InsertImage','htmlmode','separator'],
135              [
'popupeditor'],
136         ];
137
138         config.fontnames = {
139             
"Arial": "arial, helvetica, sans-serif",
140                 
"Courier New": "courier new, courier, mono",
141             
"Georgia": "Georgia, Times New Roman, Times, Serif",
142             
"Tahoma": "Tahoma, Arial, Helvetica, sans-serif",
143             
"Times New Roman": "times new roman, times, serif",
144             
"Verdana": "Verdana, Arial, Helvetica, sans-serif",
145             
"impact": "impact",
146             
"WingDings": "WingDings"
147         };
148         
149         config.fontsizes = {
150             
"1 (8 pt)": "1",
151             
"2 (10 pt)": "2",
152             
"3 (12 pt)": "3",
153             
"4 (14 pt)": "4",
154             
"5 (18 pt)": "5",
155             
"6 (24 pt)": "6",
156             
"7 (36 pt)": "7"
157         };
158
159         
//config.stylesheet = "http://www.domain.com/sample.css";
160   
161         config.fontstyles = [
// make sure classNames are defined in the page the content is being display as well in or they won't work!
162             { name:
"headline", className: "headline", classStyle: "font-family: arial black, arial; font-size: 28px; letter-spacing: -2px;" },
163             { name:
"arial red", className: "headline2", classStyle: "font-family: arial black, arial; font-size: 12px; letter-spacing: -2px; color:red" },
164             { name:
"verdana blue", className: "headline4", classStyle: "font-family: verdana; font-size: 18px; letter-spacing: -2px; color:blue" }
165
166             
// leave classStyle blank if it's defined in config.stylesheet (above), like this:
167             
// { name: "verdana blue", className: "headline4", classStyle: "" }
168         ];
169         
170         editor_generate(
'txtAnswer', config);
171      </script>
172         
173         </td>
174       </tr>
175       <tr>
176         <td width=
"17%" class="smallfont" align="right">
177         H&#
7885; tên</td>
178         <td width=
"1%" class="smallfont" align="center">
179         &nbsp;</td>
180         <td width=
"80%" class="smallfont">
181         <INPUT
value="<? echo $name; ?>" TYPE="text" NAME="txtName" CLASS=textbox size="50"></td>
182       </tr>
183         <tr>
184         <td width=
"17%" class="smallfont" align="right">
185         Email</td>
186         <td width=
"1%" class="smallfont" align="center">
187         &nbsp;</td>
188         <td width=
"80%" class="smallfont">
189         <INPUT
value="<? echo $email; ?>" TYPE="text" NAME="txtEmail" CLASS=textbox size="34"></td>
190       </tr>
191
192       <tr>
193         <td width=
"17%" class="smallfont" align="right">
194         Th&#
7913; t&#7921; s&#7855;p x&#7871;p</td>
195         <td width=
"1%" class="smallfont" align="center">
196         &nbsp;</td>
197         <td width=
"80%" class="smallfont">
198         <INPUT
value="<? echo $order; ?>" TYPE="text" NAME="txtSortOrder" CLASS=textbox size="20"></td>
199       </tr>
200
201       <tr>
202         <td width=
"17%" class="smallfont" align="right">
203         Không hi&#
7875;n th&#7883;</td>
204         <td width=
"1%" class="smallfont" align="center">
205         &nbsp;</td>
206         <td width=
"80%" class="smallfont">
207         <input type=
"checkbox" name="chkShow" value="ON" <? if ($status>0) echo 'checked' ?>></td>
208       </tr>
209
210       <tr>
211         <td width=
"17%" class="smallfont" align="right">
212         Thu&#
7897;c ch&#432;&#417;ng trinh</td>
213         <td width=
"1%" class="smallfont" align="center">
214         &nbsp;</td>
215         <td width=
"80%" class="smallfont">
216                 <
select size="1" name="txtParent">
217 <?
218         
//echo "<option value='17'>[Danh m&#7909;c g&#7889;c]</option>";
219         $cats=GetListFaqCategory();
220         
foreach ($cats as $cat)
221         {
222             
if ($cat[0]==$categories_id)
223                 echo
"<option value=".$cat[0]." selected>".$cat[1]."</option>";
224             
else
225                 echo
"<option value=".$cat[0].">".$cat[1]."</option>";
226         }
227 ?>
228         </
select>
229         
230 </td>
231       </tr>
232
233       <tr>
234         <td width=
"17%" class="smallfont">
235         <p align=
"right">
236         <INPUT TYPE=
"submit" NAME="butSaveLoai" VALUE="C&#7853;p nh&#7853;t" CLASS=button>&nbsp;</td>
237         <td width=
"1%" class="smallfont" align="center">
238         &nbsp;</td>
239         <td width=
"80%" class="smallfont"><p align="left">&nbsp;<INPUT TYPE="reset" CLASS=button value="Nh&#7853;p l&#7841;i"></td>
240       </tr>
241     </table>
242     </td>
243   </tr>
244   </table>
245 </form>



Full source code website bán hàng thương mại điện tử gần giống shopee 468.874 lượt xem

Gõ tìm kiếm nhanh...